public class Solution1668 {
    public int maxRepeating(String sequence, String word) {
        for (int i=sequence.length()/word.length();i>=1;i--){
            StringBuilder x= new StringBuilder();
            for (int j=0;j<i;j++){
                x.append(word);
            }
            if (sequence.contains(x.toString())){
                return i;
            }
        }
        return 0;
    }

    public static void main(String[] args) {
        System.out.println(new Solution1668().maxRepeating("ababc","ab"));
    }
}
